<?php
namespace app\admin\controller\common;

use think\Request;
use app\admin\controller\Base;
use app\admin\service\common\ConfigService;

class Config extends Base
{
    public function cate(Request $request){
        $param = $this->request->param();
        $service = new ConfigService();
        $data = $service->getList($param);
        return $data;
    }
    public function cateadd(Request $request){
        $param = $this->request->param();
        $service = new ConfigService();
        $data = $service->addCate($param);
        return $data;
    }
    public function cateedit(Request $request){
        $param = $this->request->param();
        $service = new ConfigService();
        $data = $service->editCate($param['id'], $param);
        return $data;
    }
    public function catedel(Request $request)
    {
        $data = $request->param();
        $ids = is_array($data['ids']) ? $data['ids'] : explode(',', $data['ids']);
        $service = new ConfigService();
        return $service->deleteCate($ids);
    }
    public function list(Request $request){
        $param = $this->request->param();
        $service = new ConfigService();
        $data = $service->getConfig($param);
        return $data;
    }
    public function save(Request $request){
        $param = $this->request->param();
        $service = new ConfigService();
        $data = $service->Save($param);
        return $data;
    }
    public function add(Request $request){
        $param = $this->request->param();
        $service = new ConfigService();
        $data = $service->Add($param);
        return $data;
    }
    public function del(Request $request)
    {
        $data = $request->param();
        $ids = is_array($data['ids']) ? $data['ids'] : explode(',', $data['ids']);
        $service = new ConfigService();
        return $service->Delete($ids);
    }




}